package com.fumihiko.modules.jxxm.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fumihiko.modules.jxxm.entity.IncomeStandardEntity;
import com.fumihiko.modules.jxxm.service.IncomeStandardService;
import com.fumihiko.common.utils.PageUtils;
import com.fumihiko.common.utils.R;



/**
 *
 *
 * @author hanwenpeng
 * @email devilzwy@gmail.com
 * @date 2021-12-31 10:21:29
 */
@RestController
@RequestMapping("jxxm/incomestandard")
public class IncomeStandardController {
    @Autowired
    private IncomeStandardService incomeStandardService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxxm:incomestandard:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = incomeStandardService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 条件查询列表
     */
    @RequestMapping("/searchList")
    @RequiresPermissions("jxxm:incomestandard:searchList")
    public R searchList(@RequestParam Map<String, Object> params){
        PageUtils page = incomeStandardService.searchPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("jxxm:incomestandard:info")
    public R info(@PathVariable("id") Long id){
		IncomeStandardEntity incomeStandard = incomeStandardService.getById(id);

        return R.ok().put("incomeStandard", incomeStandard);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxxm:incomestandard:save")
    public R save(@RequestBody IncomeStandardEntity incomeStandard){
		incomeStandardService.save(incomeStandard);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxxm:incomestandard:update")
    public R update(@RequestBody IncomeStandardEntity incomeStandard){
		incomeStandardService.updateById(incomeStandard);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxxm:incomestandard:delete")
    public R delete(@RequestBody Long[] ids){
		incomeStandardService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
